<template>
	<view class="orderItem">
		<view class="head">
			<text>{{order.desc}}</text>
			<text :class="order.status == '已完成'? 'complete':''">{{order.status}}</text>
		</view>
		<view class="foot">
			<view class="money">
				<text>总佣金：</text>
				<text class="red">{{order.amount }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			order: {
				type: Object,
				default: () => {
					return {};
				},
			},
		},
		data() {
			return {
				// 是否显示更多详情
				showMore: false,
			};
		},
		computed: {
			goodsList() {
				if (this.order.orderDetail.length <= 1) {
					return this.order.orderDetail;
				} else {
					if (!this.showMore) {
						return [this.order.orderDetail[0]];
					} else {
						return this.order.orderDetail;
					}
				}
			},
			orderStatus() {
				return status => {
					if (status == -1) {
						return this.$t('person.status1')
					}
					if (status == 0) {
						return this.$t('person.status2')
					}
					if (status == 1) {
						return this.$t('shop.cancled')
					}
					if (status == 2) {
						return this.$t('admin.delivered')
					}
					if (status == 3) {
						return this.$t('shareholder.status')
					}
				}
			}
		},
	};
</script>

<style lang="scss" scoped>
	.orderItem {
		width: 100%;
		padding: 30rpx;
		font-family: PingFang SC;
		background-color: #fff;
		color: #262626;

		.head {
			display: flex;
			align-items: center;
			justify-content: space-between;

			text:nth-child(1) {
				font-size: 28rpx;
				// font-weight: 600;
				width: 80%;
			}

			text:nth-child(2) {
				font-size: 24rpx;
				color: #f0250e;
			}

			text.complete {
				color: #8c8c8c;
			}
		}

		.goods {
			padding-top: 6rpx;

			.goodItem {
				display: flex;
				padding: 24rpx;
				border-bottom: 1px solid #f8f8f8;

				.pic {
					width: 140rpx;
					min-width: 140rpx;
					height: 140rpx;
					border-radius: 10rpx;
					overflow: hidden;
					background-color: #f1f1f1;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.info {
					flex: auto;
					margin-left: 20rpx;

					.name {
						font-size: 28rpx;
						text-overflow: -o-ellipsis-lastline;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						line-clamp: 2;
						-webkit-box-orient: vertical;
					}

					.sku {
						display: flex;
						align-items: center;
						justify-content: space-between;

						text:nth-child(2) {
							font-size: 24rpx;
							color: #8c8c8c;
						}
					}
				}
			}

			.showMore {
				display: flex;
				align-items: center;
				font-size: 24rpx;
				color: #8c8c8c;
				margin-bottom: 30rpx;
				justify-content: center;
			}

			.goodItem:last-child {
				border-bottom: none;
			}
		}

		.foot {
			padding-top: 20rpx;
			border-top: 1px solid #f8f8f8;
			display: flex;
			align-items: center;
			justify-content: flex-end;

			.money {
				font-size: 26rpx;

				.red {
					color: #f0250e;
					font-weight: 600;
				}
			}

			.status {
				font-size: 26rpx;
				color: #8c8c8c;
			}

			.status.red {
				color: #f0250e;
			}
		}
	}
</style>